<template>
  <div>
    <button @click="btn1">新增</button>
    <ul>
    <li v-for="(itms,index) in arr" :key="index">{{itms}}
    <button @click="dele(index)">删除</button>
    </li>
     
    </ul>
  
  </div>
</template>

<script>
export default {
data(){
  return{
    arr:[]
    
  }
},
methods:{
  dele(a){
    this.arr.splice(a,1)
  },
   btn1(){
    this.arr.push(Math.round(Math.random()*20))
   }
}
}
</script>

<style>

</style>